package com.cy.pj.sys.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

public interface SysUserRoleDao {

	@Delete("delete from sys_user_roles where user_id=#{userId}")
	int deleteObjectByUserId(Integer userId);
	
	//基于用户Id查询用户对于的角色Id
	@Select("select role_id from sys_user_roles where user_id=#{id}")
	List<Integer> findRoleIdsByUserId(Integer id);
	
	//保存用户和角色关系数据
	int insertObjects(Integer userId,Integer[] roleIds);

	
	//基于角色Id删除用户和角色关系数据
	@Delete("delete from sys_user_roles where role_id=#{roleId}")
	int deleteObjectsByRoleId(Integer roleId);
}
